let WebIM = require("./WebIM")["default"];
let msgType = require("./msgtype");

module.exports = function(sendableMsg, type){
	console.log(sendableMsg)
	console.log(type)
	if(type == msgType.TEXT){
		console.log(WebIM.parseEmoji(sendableMsg.value.replace(/\n/mg, "")))
		sendableMsg.value = WebIM.parseEmoji(sendableMsg.value.replace(/\n/mg, ""));
		console.log(sendableMsg)
		return sendableMsg;
	}
	else if(type == msgType.EMOJI){
		console.log(sendableMsg.value)
		return sendableMsg.value;
	}
	else if(type == msgType.IMAGE || type == msgType.VIDEO || type == msgType.AUDIO){
		console.log('这里是getMsgData')
		console.log(sendableMsg.body.body.url)
		return sendableMsg.body.body.url;
	}
	 else if (type == msgType.FILE) {
		return sendableMsg.body.body.msg
	}
	return "";
}